file object
This method will write a string or text or binary data into a file.
double write(string data)
Parameters:
data
The data to be written.
Return value:
A double containing the number of characters or bytes written.
Remarks:
If the file is opened in text mode, the return value shows the number of characters written. If, on the other hand, the file is opened as binary, then the return value shows the number of bytes written instead.
Example:
// Write to a file.
void main()
{
file test;
test.open("test.txt", "w");
test.write("I am a text file!");
test.close();
}